package es.us.lsi.mwm;

public class Circunferencia {
    private float radio;
    private Punto2D centro;
    
    public Circunferencia() {
        super();
    }


    public void setRadio(float radio) {
        this.radio = radio;
    }

    public float getRadio() {
        return radio;
    }

    public void setCentro(Punto2D centro) {
        this.centro = centro;
    }

    public Punto2D getCentro() {
        return centro;
    }
    
    public void moverCentro(float offx, float offy){
        centro.moverX(offx);
        centro.moverY(offy);
    }
    
    public double getArea(){
        return radio*(Math.PI*Math.PI);
    }
    
    public double getPerimetro(){
        return 2*Math.PI*radio;
    }


    @Override
    public boolean equals(Object object) {
        if (this == object) {
            return true;
        }
        if (!(object instanceof Circunferencia)) {
            return false;
        }
        final Circunferencia other = (Circunferencia) object;
        if (Float.compare(radio, other.radio) != 0) {
            return false;
        }
        if (!(centro == null ? other.centro == null : centro.equals(other.centro))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        final int PRIME = 37;
        int result = 1;
        result = PRIME * result + Float.floatToIntBits(radio);
        result = PRIME * result + ((centro == null) ? 0 : centro.hashCode());
        return result;
    }
    
}
